Blockchain for Enterprise: Build scalable blockchain applications with privacy, interoperability, and permissioned features by Prusty Narayan
Author:Prusty, Narayan [Prusty, Narayan]
Language: eng
Format: azw3
Tags: COM018000 - COMPUTERS / Data Processing, COM083000 - COMPUTERS / Security / Cryptography, COM062000 - COMPUTERS / Data Modeling and Design
Publisher: Packt Publishing
Published: 2018-09-25T16:00:00+00:00
Sending ether
Let's look at how to send ether to any address. To send ether, you need to use the web3.eth.sendTransaction() method. This method can be used to send any kind of transaction but is mostly used to send ether. This is because deploying a contract or calling a method of contract using this method is cumbersome as it requires you to manually generate the data of the transaction rather than automatically generating it. It takes a transaction object that has the following properties:
from: The address for the sending account. This uses the web3.eth.defaultAccount property if not specified.
to: This is optional. It's the destination address of the message and is left undefined for a contract-creation transaction.
value: This is optional. The value of the transaction is transferred in wei as well as the endowment if it's a contract-creation transaction.
gas: This is optional. It's the amount of gas to use for the transaction (unused gas is refunded). If this is not provided, then it's automatically determined.
gasPrice: This is optional. It's the price of gas for this transaction in wei, and it defaults to the mean network gas price.
data: This is optional. It's either a byte string containing the associated data of the message or, in the case of a contract-creation transaction, the initialization code.
nonce: This is optional. It's an integer. Every transaction has nonce associated with it. nonce is a counter that indicates the number of transactions made by the sender. If it is not provided, it will be automatically determined. It helps prevent replay attacks. This nonce is not the nonce associated with a block. If we are using a nonce greater than the nonce that the transaction should have, then the transaction is put in a queue until the other transactions arrive. For example, if nonce of the next transaction should be four and we set the nonce to ten, then geth will wait for the remaining six transactions before broadcasting this transaction. The transaction with nonce ten is called a queued transaction, and is not a pending transaction.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
The Mikado Method by Ola Ellnestam Daniel Brolund(27096)
Hello! Python by Anthony Briggs(25950)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(25287)
Kotlin in Action by Dmitry Jemerov(24397)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(23592)
Dependency Injection in .NET by Mark Seemann(23313)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(21949)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(20852)
Grails in Action by Glen Smith Peter Ledbrook(19870)
Adobe Camera Raw For Digital Photographers Only by Rob Sheppard(17073)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(16833)
Secrets of the JavaScript Ninja by John Resig & Bear Bibeault(14464)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(12585)
Jquery UI in Action : Master the concepts Of Jquery UI: A Step By Step Approach by ANMOL GOYAL(11866)
A Developer's Guide to Building Resilient Cloud Applications with Azure by Hamida Rebai Trabelsi(10652)
Hit Refresh by Satya Nadella(9239)
The Kubernetes Operator Framework Book by Michael Dame(8588)
Exploring Deepfakes by Bryan Lyon and Matt Tora(8446)
Robo-Advisor with Python by Aki Ranin(8391)